<html>
<head>
    <title>angularJS循环数组、对象数组</title>
    <script type="text/javascript" src="../plugins/angularjs/angular.min.js"></script>
    <meta charset="utf-8"/>
    <script>
        //定义模块
        var appArr = angular.module('myArr', []);
        appArr.controller('myArrController', function ($scope) {
            $scope.list = [2, 345, 443, 12];//定义数组

            //json对象就是angular的对象，在js中json格式不需要严格
            $scope.users = [
                {name: 'slx', age: 112, address: 'weihai'},
                {name: 'jay', age: 14, address: 'meiguo'},
                {name: 'mg', age: 45, address: 'taiwan'}
            ]
        });
    </script>
</head>

<body ng-app="myArr" ng-controller="myArrController">

<h2>循环数组、对象数组</h2>
<!--ng-repeat循环数组-->
<h3>循环普通数组</h3>
<table>
    <tr ng-repeat="i in list">
        <td>{{i}}</td>
    </tr>
    <h3>循环对象数组</h3>
    <table>
        <thead>
        <td>姓名</td>
        <td>年龄</td>
        <td>地址</td>
        </thead>
        <tr ng-repeat="user in users">
            <td>{{user.name}}</td>
            <td>{{user.age}}</td>
            <td>{{user.address}}</td>
        </tr>
    </table>
</table>
</body>
</html>
